package com.dyj.tiktok.client;

import com.dtflys.forest.annotation.*;
import com.dtflys.forest.backend.ContentType;
import com.dyj.common.domain.DyTikTokResult;
import com.dyj.common.domain.query.UserInfoQuery;
import com.dyj.common.interceptor.TikTokBodyTokenInterceptor;
import com.dyj.tiktok.domain.vo.*;

import java.io.File;

@BaseRequest(baseURL = "${tikTokDomain}")
public interface VideoClient {

    @Post(url = "${tikTokQueryVideoList}", contentType = ContentType.APPLICATION_JSON, interceptor = TikTokBodyTokenInterceptor.class)
    DyTikTokResult<QueryVideoListVo> queryVideoList(@Var("query") UserInfoQuery query, @Body("cursor") Long cursor, @Body("max_count") Integer count, @Query("fields") String fields);

    @Post(url = "${tikTokInitUploadVideo}", contentType = ContentType.APPLICATION_JSON, interceptor = TikTokBodyTokenInterceptor.class)
    DyTikTokResult<InitUploadVideoRespVo> initUploadVideo(@Var("query") UserInfoQuery query, @Body InitUploadVideoReqVo initUploadVideoReqVo);

    @Put(url = "{uploadUrl}",contentType = "video/mp4", headers = {"Content-Length: {contentLength}","Content-Range: {contentRange}"})
    void uploadVideo(@Var("uploadUrl") String uploadUrl, @Var("contentLength") Long contentLength, @Var("contentRange") String contentRange, @DataFile("data") File videoFile);

    @Post(url = "${tikTokUploadImage}", contentType = ContentType.APPLICATION_JSON, interceptor = TikTokBodyTokenInterceptor.class)
    DyTikTokResult<UploadImageRespVo> uploadImage(@Var("query") UserInfoQuery query, @Body UploadImageReqVo uploadImageReqVo);

    @Post(url = "${tikTokQueryPostStatus}", contentType = ContentType.APPLICATION_JSON, interceptor = TikTokBodyTokenInterceptor.class)
    DyTikTokResult<QueryPostStatusRespVo> queryPostStatus(@Var("query")UserInfoQuery query, @Body("publish_id") String publishId);
}
